package com.zuozuo.thread;

public class Demo1 {
    public static void main(String[] args) {
        for (int j = 0; j < 20; j++) {


            int finalJ = j;
            new Thread(() -> {
                for (int i = 0; i < 100000; i++) {
                    System.out.println("thread" + finalJ + ":" + i);
                    try {
                        Thread.sleep(0);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }).start();
        }
        for (int i = 0; i < 10000; i++) {
            System.out.println("main:" + i);
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
